<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>网络货运平台省运管数据控制台</title>
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="小镖人、社区、网络货运">
    <meta name="description" content="小镖人、社区、网络货运">
    <link rel="stylesheet" href="../../../xbr_layui_extend/layui-v2.6.8/css/layui.css">
    <style>
        .layui-layout-admin {position: fixed; top: 0; left: 0; width: 100%; height: 50px;}
        .layui-layout-admin .layui-footer{padding: 10px 0; text-align: center;left: 0}
    </style>
</head>
<body>
<div class="layui-fluid" style="padding: 15px;">
    <form class="layui-form" action="" lay-filter="form-initPlat" id="userForm" method="post" >
        <div class="layui-form-item">
            <p>提示：在云平台添加一个员工账号用于管理省运管数据，以下是添加的员工账户信息</p>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">API账户名</label>
            <div class="layui-input-block">
                <input type="text" id="username" name="username" lay-verify="required"
                       placeholder="在云平台添加的API账户名" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label">API账户秘钥</label>
            <div class="layui-input-block">
                <textarea id="customerKey" name="customerKey" lay-verify="required"
                       placeholder="请输入在云平台设置的API秘钥" class="layui-textarea"></textarea>
            </div>
        </div>
        <!--提交按钮-->
        <div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
                <div class="layui-footer">
                    <button id="text9" class="layui-btn" lay-submit="" lay-filter="post-initPlat"><i class="layui-icon">&#xe605;</i>立即提交</button>
                </div>
            </div>
        </div>
    </form>
</div>


<script src="../../../xbr_layui_extend/layui-v2.6.8/layui.js"></script>
<script>
    layui.extend({
        admin: '/platform/xbr_layui_extend/admin' //集成路径
    }).use(["admin",'form'], function () {
        const $ = layui.$, form = layui.form,admin = layui.admin;

        //上传完毕 提交表单
        form.render(null, 'form-initPlat');
        form.on('submit(post-initPlat)', function (data) {
            admin.req({
                url:"/platform/tms/initTmsConfigure",
                data: data.field,
                type: 'post',
                done: function (res) {
                    //保存成功
                    layer.msg(res.data==null?'保存成功！':'修改成功！', {
                        icon: 1, time: 1000
                    }, function () {
                        const index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.location.reload();
                        parent.layer.close(index);
                    });
                }
            });
            return false;
        });

    });
</script>
</body>
</html>